package com.common.utils.excel.excelabstract;

import cn.hutool.core.io.FileUtil;
import cn.hutool.poi.excel.sax.ExcelSaxReader;
import cn.hutool.poi.exceptions.POIException;

import java.io.File;
import java.io.InputStream;

/**
 * @Author: zengliang
 * @Description:
 * @Date:Created in 15:32 2022/1/4
 * @Modified By:
 */
public abstract class AbstractExcelSaxReader<T> implements ExcelSaxReader<T> {
    public AbstractExcelSaxReader() {
    }

    @Override
    public T read(String path) throws POIException {
        return this.read(FileUtil.file(path));
    }

    @Override
    public T read(File file) throws POIException {
        return this.read(file, -1);
    }

    @Override
    public T read(InputStream in) throws POIException {
        return this.read(in, -1);
    }

    @Override
    public T read(String path, int sheetIndex) throws POIException {
        return this.read(FileUtil.file(path), sheetIndex);
    }
}
